package com.eptok.gw.szcups.thread;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.ContextLoader;

import com.eptok.gw.szcups.dao.JdbcDao;
import com.eptok.gw.szcups.dao.bo.Cupsreveral;

public class ReveralThread extends Thread{

	private boolean isrun = true;
	protected static final Logger log = LoggerFactory.getLogger(ReveralThread.class);
	
	
	public void run(){
		while(isrun){
			try {
				Thread.sleep(10*1000);
				JdbcDao jdbcDao = (JdbcDao)ContextLoader.getCurrentWebApplicationContext().getBean("jdbcDao");
				List<Cupsreveral> list = jdbcDao.queryRerveral();
				for(Cupsreveral cupsreveral : list){
					new ReveralProcess(cupsreveral).start();
				}
			} catch (Exception e) {
				log.error("查找冲正记录",e);
			}
			
		}
	}
	
	
	
	public boolean isIsrun() {
		return isrun;
	}

	public void setIsrun(boolean isrun) {
		this.isrun = isrun;
	}

}
